package bbdd;

import java.sql.*;

import datos.*;

public class BDEmpleado {
	private static Statement s;
	private static Connection c;
	private static ResultSet reg;
	
	public static void  altaEmpleado(Empleado em, BaseDatos bbdd  ){
		String cadena="INSERT INTO empleado VALUES('" + em.getDni() + "','" + em.getNombre() + "','" + em.getApellidos() + "','" + em.getDireccion() + "','" + em.getTelefono() + "','" + em.getCargo() + "','" + em.getContrato() + "'," + em.getSueldo() + "," + em.getNumeroSS() + ",0)";
		Statement st;
		Connection c;
		bbdd.abrir();
		try{
		c=bbdd.getConexion();
		st=c.createStatement();
		st.executeUpdate(cadena);
		st.close();
		bbdd.cerrar();
		}
		catch ( SQLException e){
			System.out.println(e.getMessage());
		}
	}
	
	public static void  bajaEmpleado(Empleado em, BaseDatos bbdd  ){
		String cadena="DELETE FROM empleado WHERE dni='" + em.getDni() + "'";
		Statement st;
		Connection c;
		bbdd.abrir();
		try{
		c=bbdd.getConexion();
		st=c.createStatement();
		st.executeUpdate(cadena);
		st.close();
		bbdd.cerrar();
		}
		catch ( SQLException e){
			System.out.println(e.getMessage());
		}
	}
}
